﻿using BLL;
using DAL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace HotelCode.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DepartmentController : ControllerBase
    {
        public DepartmentController(DepartmentBLL departmentBLL)
        {
            DepartmentBLL = departmentBLL;
        }

        public DepartmentBLL DepartmentBLL { get; }
        [HttpPost]
        /// <summary>
        /// 科室添加
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public IActionResult DepartAdd(DepartmentModel info)
        {
            try
            {
               int res= DepartmentBLL.DepartAdd(info);
                return Ok(res);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        /// <summary>
        /// 显示查询 
        /// </summary>
        /// <param name="Departmen"></param>
        /// <returns></returns>
        public IActionResult GetDepartmentList(string? Departmen = "")
        {
            try
            {
                var res = DepartmentBLL.GetDepartmentList(Departmen);
                return Ok(res);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
